package com.yocard.yxyd.ui.presenter;

import com.yocard.yxyd.base.CommonSubscriber;
import com.yocard.yxyd.base.RxPresenter;
import com.yocard.yxyd.http.HttpManager;
import com.yocard.yxyd.http.model.response.TrackListBean;
import com.yocard.yxyd.ui.contract.CsmRefundContract;
import com.yocard.yxyd.utils.RxUtil;

import javax.inject.Inject;

/**
 * Created on 2019/4/16.
 */
public class RefundPresenter extends RxPresenter<CsmRefundContract.View> implements CsmRefundContract.Presenter {

    @Inject
    public RefundPresenter(HttpManager manager) {
        super(manager);
    }

    @Override
    public void fetchList(String id) {
        addSubscribe(httpManager.getTrackList(id)
                .compose(RxUtil.rxSchedulerHelper())
                .subscribeWith(new CommonSubscriber<TrackListBean>(mView) {
                    @Override
                    public void onSuccess(TrackListBean data) {
                        try {
                            mView.onFetchList(data);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                }));
    }
}
